package com.example.demo.Server.impl;

import com.example.demo.Server.Look_for_jobServer;
import com.example.demo.entity.JobPosition;
import com.example.demo.mapper.Look_for_jpb_Mapper;
import com.example.demo.result.PageResult;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class Look_for_job_impl implements Look_for_jobServer {

    @Autowired
    private Look_for_jpb_Mapper look_for_jpb_mapper;
    @Override
    public ArrayList<JobPosition> select_Look_for_jon() {

        return look_for_jpb_mapper.select_Look_for_jon();
    }

    @Override
    public int add_job(JobPosition jobPosition) {
        return look_for_jpb_mapper.add_job(jobPosition);
    }

    @Override
    public int delete_job(Integer id) {
        return look_for_jpb_mapper.delete_job(id);
    }

    @Override
    public int update_job(JobPosition jobPosition) {
        return look_for_jpb_mapper.update_job(jobPosition);
    }

    @Override
    public PageResult select_Look_for_jon_page(int page, int size,int  hrId,JobPosition jobPosition) {

        PageHelper.startPage(page,size);
        Page<JobPosition> jobPositions =  look_for_jpb_mapper.select_Look_for_jon_page(page, size,hrId,jobPosition);
        List<JobPosition> result = jobPositions.getResult();
        long total = jobPositions.getTotal();
        return new PageResult(total, result);
    }


}



